#-*- coding: UTF-8 -*-
import os
import time
import unittest
# from selenium import webdriver
from appium import webdriver

desired_caps={}
desired_caps['platformName']='Android'
desired_caps['version']='7.1.1'
desired_caps['deviceName']='HGAFQ94U'#这是测试机的型号，可以查看手机的关于本机选项获得
desired_caps["unicodeKeyboard"] = "True"# 使用unicode编码方式发送字符串
desired_caps["resetKeyboard"] = "True"# 隐藏键盘
# desired_caps['app'] = PATH('D:\\qq.apk')#被测试的App在电脑上的位置
desired_caps['appPackage'] = 'com.tencent.mobileqq'
desired_caps['appActivity'] = 'com.tencent.mobileqq.activity.SplashActivity'

driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)
ac = driver.current_activity


print('11111')
time.sleep(2)
driver.find_element_by_id("com.tencent.mobileqq:id/btn_login").click()
time.sleep(2)

driver.find_element_by_xpath("//android.widget.EditText[@content-desc='请输入QQ号码或手机或邮箱']").clear()

driver.find_element_by_xpath("//android.widget.EditText[@content-desc='请输入QQ号码或手机或邮箱']").send_keys("460690837")
driver.find_element_by_id("com.tencent.mobileqq:id/password").clear()

driver.find_element_by_id("com.tencent.mobileqq:id/password").send_keys("wc861125")

driver.find_element_by_id("com.tencent.mobileqq:id/login").click()
